import Mock from 'mockjs'

const home = Mock.mock({
  'items|30': [{
    id: '@id',
    title: '@sentence(10, 20)',
    'status|1': ['published', 'draft', 'deleted'],
    author: 'name',
    display_time: '@datetime',
    pageviews: '@integer(300, 5000)'
  }]
})
const service = Mock.mock({
  'items|30': [{
    id: '@id',
    title: '@sentence(10, 20)',
    'status|1': ['published', 'draft', 'deleted'],
    author: 'name',
    display_time: '@datetime',
    pageviews: '@integer(300, 5000)'
  }]
})
export default [
  // user login
  {
    url: '/service/home',
    type: 'post',
    response: config => {
      const items = home.items
      return {
        IsSuccess: 1,
        Data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/service/list',
    type: 'get',
    response: config => {
      const items = service.items
      return {
        IsSuccess: 1,
        Data: {
          total: items.length,
          items: items
        }
      }
    }
  }
]
